package com.heima.article.web.fegin;

import com.heima.article.service.ArticleService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dto.WmNewsDto;
import com.heima.model.wemedia.dto.WmNewsTransferDto;
import com.heima.model.wemedia.pojo.WmNews;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/article")
public class ArticleFenginController {
    @Autowired
    private ArticleService articleService;

    @PostMapping("/saveArticle")
    public ResponseResult<Long> saveArticle(@RequestBody WmNewsTransferDto dto) throws TemplateException, IOException {

        return  articleService.saveArticle(dto);
    }
}
